package ru.alt22.visor.php.ui.wizards;

import org.eclipse.core.resources.IFolder;
import org.eclipse.ui.dialogs.WizardNewFolderMainPage;
import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;

import ru.alt22.visor.php.properties.Properties;
import ru.alt22.visor.php.ui.core.wizards.NewTypeWizard;

public class NewSourceFodlerWizard extends NewTypeWizard {
	private WizardNewFolderMainPage page;

	public void addPages() {
		page = new WizardNewFolderMainPage("", getSelection()); 
        addPage(page);
	}

    public boolean performFinish() {
        IFolder folder = page.createNewFolder();
        if (folder == null) {
			return false;
		}

        Properties.setPropertyValue(folder, Properties.SOURCE_FOLDER_PROPERTY, "true");
        BasicNewResourceWizard.selectAndReveal(folder, getWorkbench().getActiveWorkbenchWindow());

        return true;
    }

}